<!--创建"发票详细"标签-->
<#assign receiptDetailTag = newTag("receiptDetailTag") />
<!--调用“发票详细”标签-->
<#assign receiptDetail = receiptDetailTag('{"id":"${id}"}') />
<div class="form_wrap">
	<div class="rece_hide_wp">
		<form id="member_rece" class="validate" action="" method="post">
			<input type="hidden" id="recid" value="${receiptDetail.id}">
			<input type="hidden" id="content" value="${receiptDetail.content}">
			<input type="hidden" id="is_default" value="${receiptDetail.is_default}">
			<div class="ckt-control">
				<div class="rece_input_wp">
					<span>默认发票</span>
						<label>
							<input type="radio" value="0" name="is_default"> 否
						</label> 
						<label>
							<input type="radio" value="1" name="is_default"> 是
						</label>
					</div>
					<div class="rece_input_wp">
					<span>发票抬头</span> 
						<label>
							<input type="text" value="${receiptDetail.title}" name="title">
						</label>
					</div>
					<div class="rece_input_wp">
					<span>发票类型</span>
						<label>
							<input type="radio" value="办公用品" name="content"> 办公用品
						</label>
						<label>
							<input type="radio" value="劳保用品" name="content"> 劳保用品
						</label>
						<label>
							<input type="radio" value="耗材" name="content"> 耗材
						</label>
					</div>
				<div class="btns_info btn-div">
					<input class="btn_save green-btn" type="button" id="receipt_edit" value="保存修改"/>
				</div>
			</div>
		</form>
	</div>
</div>
<script> 
$(function () {
	var conval = $("#content").val();
	var defval = $("#is_default").val();
	$("input[name='content'][value='"+conval+"']").attr("checked",true);
	$("input[name='is_default'][value='"+defval+"']").attr("checked",true);

	/*修改地址专用*/
	$("#receipt_edit").on('click', function () {
		var titleval = $("input[name='title']").val();
		if(titleval == ""){
			alert("发票抬头不能为空");
			return false;
			}
	    var recid = $("#recid").val();
	    $(".validate").ajaxSubmit({
	    	tpye : "post" ,
			url :"${ctx}/api/shop/member-receipt/edit.do?id="+recid,
			dataType : 'json',
			success : function(data) {
				if(data.result==1){
	                $.message.success(data.message, function () {
	                    location.href = "receipt.html"
	                })
	            }else{
	            	$.message.error(data.message);
	            }
			},
			error : function(e) {
				$.message.error("出现错误 ，请重试");
			}
	    })
	});
})
</script>